import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    currentUser:null,
    isLogin:false,
    token:""//以后做服务器优化的时候用token
  },
  getters:{
    getCurrentUser(state){
      return state.currentUser;
    },
    getIsLogin(state){
      return state.isLogin;
    },
    getToken(state){
      return state.token;
    }
  },
  mutations: {
    setCurrentUser(state,payLoad){
      state.currentUser=payLoad.userInfo;
    },
    setIsLogin(state,payLoad){
      state.isLogin=payLoad.isLogin;
    },
    setToken(state,payLoad){
      state.token=payLoad.token;
    }
  },
  actions: {
  },
  modules: {
  }
})
